package cn.antalk.top.user.dao;

import cn.antalk.top.user.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: WackyBoy
 * @Date: 2021/12/6 20:23
 */
@Mapper
public interface UserDao {

    @Select("select * from user where uname = #{uname}")
    User queryUserByUname(@Param("uname") String uname);

    @Insert("insert into user(uname, password) values(#{uname}, #{pwd_encoder})")
    int registerUserByAll(@Param("uname") String uname, @Param("pwd_encoder") String pwd_encoder);

    @Select("select talk_id from `like` where uid = #{uid} and `islike` = 1")
    List<Integer> queryAllLikeTalkIdByUid(@Param("uid") int uid);
}
